function showCode(url) {
    $('#qrcode').qrcode({ width: 64, height: 64, text: url });
}

$(document).ready(function () {
    $(".spot-item").on("click", function () {
        var idx = $(this).data("idx");
        console.log(idx);
        $.get("/site/siteList/?parent=" + idx, function (res, status) {
            if (status == "success") {
                console.log(res);
                $("#spotlist tbody").html('');
                $.each(res.resmsg, function (index, value) {
                    console.log(value);
                    $("#spotlist tbody").append('<tr><td>' + value.id + '</td><td>' + value.basename + '</td><td>' + value.aprice / 100 + '</td><td><a href="#" class="showcode btn btn-info btn-sm" role="button">显示二维码</a></td></tr>');
                });
            }
            $(".showcode").on("click", function () {
                var pid = $(this).parent().prev().prev().prev().text();
                console.log(pid);
                var url = "/pay/payment/?idx=" + pid;
                showCode(url);
            });
        });


    });
});